<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="cn.edu.zut.model.BorrowBook" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.edu.zut.model.Reader" %><%--
  Created by IntelliJ IDEA.
  User: lf
  Date: 19-6-23
  Time: 上午9:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>管理员界面</title>
<%--    <meta name="viewport" content="width=device-width, initial-scale=1">--%>
<%--    <link rel="stylesheet" href="/js/bootstrap.min.css">--%>
<%--    <script src="/js/jquery.min.js"></script>--%>
<%--    <script src="/js/bootstrap.min.js"></script>--%>
<%--    <script src="/js/bootstrap-table.min.css"></script>--%>
<%--    <script src="/js/bootstrap-table.min.js"></script>--%>
<%--    <script src="/js/borrowBook.js"></script>--%>
</head>
<style type="text/css">
    *{
        margin: 0;
        padding: 0;
    }
    body{
        background-color: lightgray;
    }
    h1{
        background-color: aqua;
    }
    label{
        background-color: #3BD9FF;
    }
    td{
        text-align: center;
    }
    table{

        background-color: lightgray;
    }
    label {
        background-color: #3BD9FF;
    }
</style>
<body>
<h1 align="center">借阅管理</h1>
<%--<table class="table table-striped  table-bordered table-condensed" id="table_page1"--%>
<%--       data-pagination="true"--%>
<%--       data-side-pagination="client"--%>
<%--       data-page-size="3">--%>
<div class="search">
    <div class="searchInner" align="center">
        <form method="get" action="/searchById">
            <label>请输入借阅者的Id:</label><input type="text" name="id"><input type="submit" value="查阅借阅记录">
        </form>
    </div>
</div>
</br>

<table border="1px" width="1200px">
<tr>
    <td class="label">读者号</td>
    <td class="label">借阅书籍号</td>
    <td class="label">身份</td>
    <td class="label">借书日期</td>
    <td class="label">应还日期</td>
    <td class="label">还书日期</td>
    <td class="label">逾期所处罚款</td>
    <td class="label">是否已还</td>
    <td class="label">操作</td>
</tr>
    <c:forEach items="${borrowBooks}" var="borrowBook">
            <tr>
            <td>${borrowBook.getReaderId()}</td>
            <td>${borrowBook.getBookId()}</td>
                <c:if test="${reader.getType()==1}">
                    <td>教师</td>
                </c:if>
                <c:if test="${reader.getType()==2}">
                    <td>学生</td>
                </c:if>
            <td>${borrowBook.getBorrowDate()}</td>
            <td>${borrowBook.getShouldReturn()}</td>
            <td>${borrowBook.getReturnDate()}</td>
            <td>${borrowBook.getFine()}</td>
                <c:if test="${borrowBook.getFlag()==0}">
                    <td>未还</td>
                </c:if>
                <c:if test="${borrowBook.getFlag()==1}">
                    <td>已还</td>
                </c:if>
                <c:if test="${borrowBook.getFlag()==1}">
                    <td><a href='/deleteBorrowBook?id=${borrowBook.getReaderId()}&&bookid=${borrowBook.getBookId()}'>删除</a></td>
                </c:if>
                <c:if test="${borrowBook.getFlag()==0}">
                    <td><a href='/updateBorrowBook?id=${borrowBook.getReaderId()}&&bookid=${borrowBook.getBookId()}'>一键还书</a></td>
                </c:if>
            </tr>
    </c:forEach>
</table>
<script type="text/javascript">
    window.onload=function ShowDiv(){
        if(${noRecord==1}) {
        alert("亲，您还没有借过书！");
        }
    };
</script>
</body>
</html>
